#include "stdafx.h"
#include "RadioButtonExample.h"

void RadioButtonExample::loadFile(const String& fileName, FCView *view){
    FCUIXml::loadFile(fileName, view);
    //获取第二页
    FCTabPage *tabPage = getTabPage(L"TabPage2");
    FCRadioButton *radioButton = new FCRadioButton();
    FCPoint point = {100,100};
    radioButton->setLocation(point);
    FCSize size = {100,20};
    radioButton->setSize(size);
    tabPage->addView(radioButton);
    radioButton->setText(L"选项");
    radioButton->setChecked(true);

    //从Xml中获取按钮
    FCRadioButton *button1 = getRadioButton(L"RadioButton");
    FCRadioButton *button2 = getRadioButton(L"RadioButton2");
    FCRadioButton *button3 = getRadioButton(L"RadioButton3");

    //绑定选项改变事件
    button1->addEvent((FCEventCallBack*)this, FCEventID_CheckedChanged, this);
    button2->addEvent((FCEventCallBack*)this, FCEventID_CheckedChanged, this);
    button3->addEvent((FCEventCallBack*)this, FCEventID_CheckedChanged, this);
    radioButton->addEvent((FCEventCallBack*)this, FCEventID_CheckedChanged, this);
}

void RadioButtonExample::callEvent(String eventName, Object sender, Object invoke){
    FCRadioButton *radioButton = (FCRadioButton*)sender;
}
